package com.zhangjingcheng.yunyixia.util;

import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;

@Slf4j
public class HttpClientUtil {

    // get请求
    public static JSONObject doGet(String url) {
        String response = HttpUtil.get(url);
        return JSONUtil.parseObj(response);
    }

    // get请求带参数
    public static JSONObject doGet(String url, Map<String, Object> params) {
        String response = HttpUtil.get(url, params);
        return JSONUtil.parseObj(response);
    }
}
